<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:include="owner/checkTasks::head"></head>
<body>

<!--<h1>Hello Spring Security</h1>-->
<!--<p>这个界面没有受保护，你可以进已被保护的界面.</p>-->


<div id="wrapper">
    <nav class="navbar navbar-default top-navbar" role="navigation">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a th:replace="user/myTasks::navbar-brand"></a>
            <div id="sideNav" href="">
                <i class="fa fa-bars icon"></i>

            </div>
        </div>


        <ul th:replace="user/myTasks::navbar"></ul>
    </nav>
    <!--/. NAV TOP  -->
    <nav th:replace="user/myTasks::ltree"></nav>
    <!-- /. NAV SIDE  -->

    <div id="page-wrapper">
        <div class="header">
            <h1 class="page-header">
                任务测试
                <small>质量检查.</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#">Home</a></li>
                <li class="active">任务测试</li>
            </ol>


        </div>
        <div th:replace="user/myTasks::editPasswd"></div>
        <div id="page-inner">
            <div class="row">
                <div th:if="${taskModel.task!=null}" th:include="user/taskDetail::detail"></div>
                <div class="col-md-12">
                    <!--    Bordered Table  -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            待领任务
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="table-responsive table-bordered">
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>任务分类</th>
                                        <th>任务名称</th>
                                        <th>创建时间</th>
                                        <th>项目名</th>
                                        <th>状态</th>
                                        <th>组长</th>
                                        <th>执行人</th>
                                        <th>操作</th>

                                    </tr>
                                    </thead>
                                    <tbody class="result">
                                    <tr th:each="task,iterStat: ${taskModel.taskList}">
                                        <td th:text="${iterStat.index}+1">0</td>
                                        <td th:text="${task.typeName}"></td>
                                        <td th:text="${task.taskName}"></td>
                                        <td th:text="${task.cDate!=null}?${#dates.format(task.cDate,'yyyy-MM-dd HH:mm')}:''"></td>
                                        <td th:text="${task.project.projectName}"></td>
                                        <td th:text="${task.finishName}"></td>
                                        <td th:text="${task.project.user.cname}"></td>
                                        <td th:text="${task.receiverName}"></td>

                                        <td>
                                            <a href="#" data-toggle="modal" data-target="#myModal"
                                               class="btn btn-primary pull" th:data="${task.taskId}">领取</a>
                                            <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
                                                 aria-labelledby="myModalLabel" aria-hidden="true">
                                                <div class="modal-dialog">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <button type="button" class="close" data-dismiss="modal"
                                                                    aria-hidden="true">&times;</button>
                                                            <h4 class="modal-title" id="myModalLabel">领取形式</h4>
                                                        </div>
                                                        <div class="modal-body">
                                                            请确认领取测试任务！

                                                        </div>
                                                        <div class="modal-footer">
                                                            <button type="button" class="btn btn-default"
                                                                    data-dismiss="modal">Close
                                                            </button>
                                                            <button type="button" class="btn btn-primary sure"
                                                            >确定
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                                test
                                            </div>
                                            <a href="#" th:href="@{'/test/'+${task.taskId}}"
                                               class="btn btn-primary detail">详情</a>

                                        </td>
                                    </tr>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <!--  End  Bordered Table  -->
                </div>
                <foot class="text-center" th:include="user/myTasks::copyright"></foot>
            </div>
        </div>



    </div>
    <!-- /. PAGE INNER  -->
</div>
<div th:replace="owner/checkTasks::js1"></div>
<script type="text/javascript" th:inline="javascript">
    $(function () {
        $('.table').DataTable({
            language: {
                url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/Chinese.json'
            },
            autoWidth: false,  //禁用自动调整列宽
            stripeClasses: ["odd", "even"],  //为奇偶行加上样式，兼容不支持CSS伪类的场合
            processing: true,  //隐藏加载提示,自行处理
            searching: false,  //禁用原生搜索
            orderMulti: false,  //启用多列排序
            order: [],  //取消默认排序查询,否则复选框一列会出现小箭头
            renderer: "bootstrap",  //渲染样式：Bootstrap和jquery-ui
            pagingType: "simple_numbers",  //分页样式：simple,simple_numbers,full,full_numbers
        });
        $("#logout").click(function () {
            $("#outfrom").submit();
        })
        $(".pull").click(function () {
            $(".sure").attr("data", $(this).attr("data"));
        })
        $(".sure").click(function () {
            $.get("/test/done", {task_id: $(this).attr("data")}, function (d) {
                window.location.href = "/test/"
            });
        });
        //自定义格式选择
        $("#enddate").jeDate({

            minDate: $.nowDate({DD: 0}),//0代表今天，-1代表昨天，-2代表前天，以此类推
            maxDate: $.nowDate({DD: +(7 - $.getLunar($.nowDate({DD: 0}), 'YYYY-MM-DD').nWeek)}),
            initDate: [{hh: 18, mm: 00, ss: 00}, false],
            isinitVal: true,
            format: "YYYY-MM-DD hh:mm:ss"

        });


        $(".surePasswd").click(function () {
            $.get("/editPassword", {passwd: $("#passwd").val()}, function (d) {
                alert("修改成功");
            });

        });
    })
</script>
<div th:replace="owner/checkTasks::js2"></div>


</body>
</html>
